package com.example.android.story.Utils;

import android.arch.lifecycle.LiveData;
import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Delete;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.Query;
import android.arch.persistence.room.Update;

import java.util.List;

/**
 * Created by android on 18-5-21.
 */

@Dao
public interface StoryDao {
    @Query("select * from _story")
    public LiveData<List<Story>> getAllStoriesLiveData();

    @Query("select * from _story")
    public List<Story> getAllStories();

    @Query("select * from _story where title=:story_title")
    public LiveData<Story> getStoryLiveData(String story_title);

    @Query("select * from _story where title=:story_title")
    public Story getStory(String story_title);

    @Delete
    public void deleteStory(Story ... stories);

    @Update
    public void updateStory(Story ...stories);

    @Insert
    public void insertStory(Story ... stories);
}
